<template>
  <div class="message-card">
    <van-image
      style="position: relative;"
      width="32"
      height="32"
      :src="cardImg"
    >
      <p v-if="!read" class="point" />
    </van-image>
    <div class="info-box">
      <p class="title">{{ title }}<span>{{ time }}</span></p>
      <p class="message">{{ message }}</p>
    </div>
  </div>
</template>

<script>
export default {
  name: 'messageCard',
  props: {
    title: {
      type: String
    },
    message: {
      type: String
    },
    cardImg: {
      type: String
    },
    time: {
      type: String
    },
    read: {
      type: Boolean,
      default: true
    }
  }
}
</script>

<style scoped>
  .message-card {
    padding: 16px;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    flex-direction: row;
  }
  .point {
    width:6px;
    height:6px;
    border-radius:50%;
    border: 1px solid #ffffff;
    background:#FF5219;
    position: absolute;
    top: -0.5px;
    right: -3.5px;
    z-index: 99;
  }

  .info-box {
    margin-left: 16px;
    width: calc(100% - 48px);
    padding-top: 3px;
  }
  .info-box .title {
    width: 100%;
    color: #333333;
    font-size: 18px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .info-box .title span {
    color: #999999;
    font-size: 12px;
    position: relative;
    top: -10px;
  }
  .info-box .message {
    width: 100%;
    color: #666666;
    font-size: 14px;
  }
</style>
